<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*,com.book.model.*,com.book.formbean.*"  pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><spring:message code="html.result.title"/></title>
	<%
BookPage bookPage=(BookPage)request.getAttribute("bookPage");
BookForm bookForm=(BookForm)request.getAttribute("bookForm");
Type type=(Type)request.getAttribute("type");

List<Book> books=bookPage.getBooks();
int bookCount=bookPage.getBookCount();
int pageNo=bookForm.getPageNo();
int pageSize=bookForm.getPageSize();
int booksSize=books.size();
int totalPageSize=0;
if(bookCount%pageSize==0){totalPageSize=bookCount/pageSize;}else{totalPageSize=bookCount/pageSize+1;}
%>
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> 
	<script language="javascript">
 
	function getSelectedValue(name)
	{
	var obj=document.getElementById(name);
	return obj.value;
	}
	
	function search()
	{
		if(checkConditions())
		{
			document.getElementById("bookForm").submit();
		}
	}
	
	
	function checkConditions()
	{
		return true;
	}
	
	</script>
	<link rel="stylesheet" type="text/css" href="resources/style/base.css" media="screen" />
</head>
<body>
	<div class="wrapper">
		<div class="header">
			<embed src="resources/flash/111.swf" width="1007" height="223"/>
		</div>
		<div class="nav">
		
		</div>
		<div class="main">
			<div class="searchbox f-l">	
				 <table >
					  <tr>
					
					    <td align="center">&nbsp;<spring:message code="book.title"/></td>
						<td align="center">&nbsp;<spring:message code="book.author"/></td>
					    <td align="center">&nbsp;<spring:message code="book.type"/></td>
					    <td align="center">&nbsp;<spring:message code="book.time"/></td>
					    <td align="center">&nbsp;<spring:message code="table.book.operation"/></td>
					
					  </tr>
						  <%
							for(int i=0;i<booksSize;i++)
							{
							Book book=books.get(i);
						%>
							
							 <tr>
						
						    <td align="center">&nbsp;<%=book.getTitle()%></td>
							    <td align="center">&nbsp;<%=book.getAuthor()%></td>
						    <td align="center">&nbsp;<%=book.getType()%></td>
						    <td align="center">&nbsp;<%=book.getDateToString()%></td>
						    <td align="center">&nbsp;<a href="download?path=<%=java.net.URLEncoder.encode(book.getPath(), "utf-8")%>&id=<%=book.getId()%>"><spring:message code="book.operation.download"/></a>&nbsp;&nbsp;&nbsp;<a href="showContent?path=<%=java.net.URLEncoder.encode(book.getPath(), "utf-8")%>&id=<%=book.getId()%>"><spring:message code="book.operation.view"/></a></td>
						
						  </tr>
							<%
							}
						%>
					 
					</table>
					
					<table >
					  <tr>
					    <td align="center"><%if(pageNo==1){%><b><spring:message code="table.book.page.prev"/></b><%}else{%><a href="search.do?pageNo=<%=pageNo-1%>&title=<%=bookForm.getTitle()%>&type1=<%=bookForm.getType1()%>&type2=<%=bookForm.getType2()%>&type3=<%=bookForm.getType3()%>&author=<%=bookForm.getAuthor()%>" ><b><spring:message code="table.book.page.prev"/></b></a><%}%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<%if(pageNo==totalPageSize){%><b><spring:message code="table.book.page.next"/></b><%}else{%><a href="search.do?pageNo=<%=pageNo+1%>&title=<%=bookForm.getTitle()%>&type1=<%=bookForm.getType1()%>&type2=<%=bookForm.getType2()%>&type3=<%=bookForm.getType3()%>&author=<%=bookForm.getAuthor()%>" ><b><spring:message code="table.book.page.next"/></b></a><%}%></td>
					  </tr>
					</table>
			</div>			
			<div class="classify f-r">
				<ul>
					 
					<li><a href="search.do?title=&author=&type1=1&type2=ALL&type3=ALL">བཀའབསྟན།</a></li>
					<li><a href="search.do?title=&author=&type1=2&type2=ALL&type3=ALL">རྙིང་མ།</a></li>
					<li><a href="search.do?title=&author=&type1=3&type2=ALL&type3=ALL">བཀའ་བདམས།</a></li>
					<li><a href="search.do?title=&author=&type1=4&type2=ALL&type3=ALL">ལམ་འབྲས།</a></li>
					<li><a href="search.do?title=&author=&type1=5&type2=ALL&type3=ALL">བཀའ་བརྒྱུད།</a></li>
					<li><a href="search.do?title=&author=&type1=6&type2=ALL&type3=ALL">ཤངས་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=7&type2=ALL&type3=ALL">ཞི་བྱེད།</a></li>
					<li><a href="search.do?title=&author=&type1=8&type2=ALL&type3=ALL">བསྙེན་བསྒྲུབ།</a></li>
					<li><a href="search.do?title=&author=&type1=9&type2=ALL&type3=ALL">སྦྱོར་དྲུག</a></li>
					<li><a href="search.do?title=&author=&type1=10&type2=ALL&type3=ALL">ཆེད་བསྒྲིགས།</a></li>
					<li><a href="search.do?title=&author=&type1=11&type2=ALL&type3=ALL">གཡུང་དྲུང་བོན</a></li>
					<li><a href="search.do?title=&author=&type1=12&type2=ALL&type3=ALL">དམངས་ཁྲོད་རིག་གནས།</a></li>
					
					
					<li><a href="search.do?title=&author=&type1=13&type2=ALL&type3=ALL">སྒྲ་རིག་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=14&type2=ALL&type3=ALL">ཚད་མ་རིག་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=15&type2=ALL&type3=ALL">བཟོ་རིག་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=16&type2=ALL&type3=ALL">གསོ་བ་རིག་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=17&type2=ALL&type3=ALL">ནང་དོན་རིག་པ།</a></li>
					<li><a href="search.do?title=&author=&type1=18&type2=ALL&type3=ALL">སྙན་ངག།</a></li>
					<li><a href="search.do?title=&author=&type1=19&type2=ALL&type3=ALL">མངོན་བརྗོད།</a></li>
					<li><a href="search.do?title=&author=&type1=20&type2=ALL&type3=ALL">སྡེབ་སྦྱོར།</a></li>
					<li><a href="search.do?title=&author=&type1=21&type2=ALL&type3=ALL">ཟློས་གར།</a></li>
					<li><a href="search.do?title=&author=&type1=22&type2=ALL&type3=ALL">སྐར་རྩིས།</a></li>
					
					
					<li><a href="search.do?title=&author=&type1=23&type2=ALL&type3=ALL">ཐོན་མི།</a></li>
					<li><a href="search.do?title=&author=&type1=24&type2=ALL&type3=ALL">བཻ་རོ།</a></li>
				</ul>
			</div>
			
		</div>
		<div class="show">
		
		</div>
		<div class="footer">
			<div class="classify">
				<ul>
					<li><a href="search.do?title=&author=&type1=25&type2=ALL&type3=ALL">སྐ་བ་དཔལ་བརྩེགས།</a></li>
					<li><a href="search.do?title=&author=&type1=26&type2=ALL&type3=ALL">ཅོག་རོ་ཀླུ་རྒྱལ།</a></li>
					<li><a href="search.do?title=&author=&type1=27&type2=ALL&type3=ALL">ཞང་ཡེ་ཤེས་སྡེ།</a></li>
					<li><a href="search.do?title=&author=&type1=28&type2=ALL&type3=ALL">ལོ་ཆེན་རིན་བཟང་།</a></li>
					<li><a href="search.do?title=&author=&type1=29&type2=ALL&type3=ALL">རྔོག་ལོ་ཆེན།</a></li>
					<li><a href="search.do?title=&author=&type1=30&type2=ALL&type3=ALL">ས་པཎ། </a></li>
					<li><a href="search.do?title=&author=&type1=31&type2=ALL&type3=ALL">བུ་སྟོན།</a></li>
					<li>
						<a href="#">分类一8</a>
					</li>
					<li>
						<a href="#">分类一1</a>
					</li>
					<li>
						<a href="#">分类一2</a>
					</li>
					<li>
						<a href="#">分类一3</a>
					</li>
					<li>
						<a href="#">分类一4</a>
					</li>
					<li>
						<a href="#">分类一1</a>
					</li>
					<li>
						<a href="#">分类一2</a>
					</li>
					<li>
						<a href="#">分类一3</a>
					</li>
					<li>
						<a href="#">分类一4</a>
					</li>
					<li>
						<a href="#">分类一5</a>
					</li>
					<li>
						<a href="#">分类一6</a>
					</li>
					<li>
						<a href="#">分类一7</a>
					</li>
					<li>
						<a href="#">分类一8</a>
					</li>
					<li>
						<a href="#">分类一1</a>
					</li>
					<li>
						<a href="#">分类一2</a>
					</li>
					<li>
						<a href="#">分类一3</a>
					</li>
					<li>
						<a href="#">分类一4</a>
					</li>
					<li>
						<a href="#">分类一5</a>
					</li>
					<li>
						<a href="#">分类一6</a>
					</li>
					<li>
						<a href="#">分类一7</a>
					</li>
					<li>
						<a href="#">分类一8</a>
					</li>
					<li>
						<a href="#">分类一1</a>
					</li>
					<li>
						<a href="#">分类一2</a>
					</li>
					<li>
						<a href="#">分类一3</a>
					</li>
					<li>
						<a href="#">分类一4</a>
					</li>
					<li>
						<a href="#">分类一5</a>
					</li>
					<li>
						<a href="#">分类一6</a>
					</li>
					<li>
						<a href="#">分类一7</a>
					</li>
					<li>
						<a href="#">分类一8</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
</body>
</html>